-
Notifications
You must be signed in to change notification settings - Fork 851
Fix HostDBInfo::is_down condition #12846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a logical error in the HostDBInfo::is_down method where the condition was inverted, causing it to incorrectly determine when a host should be considered down based on its failure window.
Changes:
- Corrected the comparison operator in
is_down()from<to>=to properly check if a host is still within its failure window
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bryancall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make comments, it is confusing
|
Approved. Maybe check with @serrislew and @cmcfarlen as well since it sounds like they looked into this previously. |
|
I wrote comment to clarify. Please take another look. |
|
I talked with @serrislew and @cmcfarlen, we found her patch has almost the same change in this function with other changes. And we agreed with shipping this PR first. |
bryancall
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The inverted condition is clearly a bug — last_fail + fail_window < now returns true when the fail window has expired (host should be UP), not when the host is still down. The fix correctly flips this to now <= last_fail + fail_window.
The ASCII timeline diagram in the comment is a nice addition — makes the time-window semantics immediately clear.
SRV-only impact, CI green, straightforward fix.
The condition of
HostDBInfo::is_downseems opposite.This function is only used by
HostDBRecord::select_best_srv(), so only SRV record case is affected.trafficserver/src/iocore/hostdb/HostDB.cc
Lines 1609 to 1611 in 2a30bcc